package org.xxpay.core.common.vo;

import java.io.Serializable;
import java.util.List;

/**
 * application.yml 移植到DB中的配置变量
 **/
public class DBSmsConfig implements Serializable {

    public static final String endpointName = "cn-hangzhou";

    public static final String regionId = "cn-hangzhou";

    //产品名称:云通信短信API产品,开发者无需替换
    public static final String product = "Dysmsapi";
    //产品域名,开发者无需替换
    public static final String domain = "dysmsapi.aliyuncs.com";

    public static final byte BIZ_TYPE_REGISTER = 22;


    /** id **/
    private String accessKeyId;

    /** key **/
    private String accessKeySecret;

    /** 签名串 **/
    private String signName;

    /** 短信模板配置项 **/
    private List<SmsTemplate> smsTemplates;

    public static class SmsTemplate{

        private Byte bizType;
        private String bizName;
        private String templateCode;
        private String templateParam;

        public Byte getBizType() {
            return bizType;
        }

        public void setBizType(Byte bizType) {
            this.bizType = bizType;
        }

        public String getBizName() {
            return bizName;
        }

        public void setBizName(String bizName) {
            this.bizName = bizName;
        }

        public String getTemplateCode() {
            return templateCode;
        }

        public void setTemplateCode(String templateCode) {
            this.templateCode = templateCode;
        }

        public String getTemplateParam() {
            return templateParam;
        }

        public void setTemplateParam(String templateParam) {
            this.templateParam = templateParam;
        }
    }

    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }

    public String getSignName() {
        return signName;
    }

    public void setSignName(String signName) {
        this.signName = signName;
    }

    public List<SmsTemplate> getSmsTemplates() {
        return smsTemplates;
    }

    public void setSmsTemplates(List<SmsTemplate> smsTemplates) {
        this.smsTemplates = smsTemplates;
    }

    public SmsTemplate getByBizId(Byte bizType){

        for (SmsTemplate smsTemplate : this.getSmsTemplates()) {
            if(smsTemplate.getBizType().equals(bizType)){
                return smsTemplate;
            }
        }

        return null;
    }

}
